package com.example.backend.services.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.backend.common.Result;
import com.example.backend.mapper.BorrowMapper;
import com.example.backend.pojo.Book;
import com.example.backend.pojo.Borrow;
import com.example.backend.services.BorrowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class BorrowServiceImpl extends ServiceImpl<BorrowMapper, Borrow> implements BorrowService {
    @Autowired
    BorrowMapper bookMapper;
    @Override
    public Result getBorrowList() {
        List<Map<String, Object>> records = bookMapper.selectBooksWithBorrowAndBookName();
        return Result.success("success").data("records", records);
    }
}